package cn.itsource.fallback;

import cn.itsource.api.DriverRemoteApi;
import cn.itsource.result.JSONResult;
import org.springframework.cloud.openfeign.FallbackFactory;

public class DriverRemoteApiFallbackFactory implements FallbackFactory<DriverRemoteApi> {
    @Override
    public DriverRemoteApi create(Throwable cause) {
        return new DriverRemoteApi() {
            @Override
            public JSONResult getCancelAndComplaint() {
                return JSONResult.error(cause.getMessage());
            }
        };
    }
}
